﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.OracleClient;
using System.Data;
namespace OracleDAL.ResourceManage
{
     public   class ResourceBase
    {
        #region  成员方法
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.ResourceManage.ResourceBase GetModel(string RESID)
        {
            OracleParameter[] parameters = {
					new OracleParameter("RESID_in", OracleType.VarChar,64),new OracleParameter("v_cursor",OracleType.Cursor)};
            parameters[0].Value = RESID;
            parameters[1].Direction = System.Data.ParameterDirection.Output;
            

            Model.ResourceManage.ResourceBase model = new Model.ResourceManage.ResourceBase();
            System.Data.DataSet ds = DBUtility.OracleHelper.RunProcedure("CFG_RESOURCE_INFO_GetModel", parameters, "ds");
            if (ds.Tables[0].Rows.Count > 0)
            {
                model.RESID = ds.Tables[0].Rows[0]["RESID"].ToString();
                model.JUDGEUNIQUE = ds.Tables[0].Rows[0]["JUDGEUNIQUE"].ToString();
                model.HOTKEY = ds.Tables[0].Rows[0]["HOTKEY"].ToString();
                model.ICON = ds.Tables[0].Rows[0]["ICON"].ToString();
                model.REMARK = ds.Tables[0].Rows[0]["REMARK"].ToString();
                model.ISDELETE = ds.Tables[0].Rows[0]["ISDELETE"].ToString();
                model.ISORDER = ds.Tables[0].Rows[0]["ISORDER"].ToString();
                model.ISROWNUM = ds.Tables[0].Rows[0]["ISROWNUM"].ToString();
                model.NETWORKID = ds.Tables[0].Rows[0]["NETWORKID"].ToString();
                model.QUERYFROMVIEW = ds.Tables[0].Rows[0]["QUERYFROMVIEW"].ToString();
                model.MODIFYINFOTABLE = ds.Tables[0].Rows[0]["MODIFYINFOTABLE"].ToString();
                model.VIEWINFO = ds.Tables[0].Rows[0]["VIEWINFO"].ToString();
                model.ISRAGATORY = ds.Tables[0].Rows[0]["ISRAGATORY"].ToString();
                model.ISADDITIVE = ds.Tables[0].Rows[0]["ISADDITIVE"].ToString();
                model.ISEDITABLE = ds.Tables[0].Rows[0]["ISEDITABLE"].ToString();
                model.NEEDAUTOCODE = ds.Tables[0].Rows[0]["NEEDAUTOCODE"].ToString();
                return model;
            }
            else
            {
                return null;
            }
        }
        #endregion  成员方法
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select RESID,JUDGEUNIQUE,HOTKEY,ICON,REMARK,ISDELETE,ISORDER,ISROWNUM,NETWORKID,QUERYFROMVIEW,MODIFYINFOTABLE,VIEWINFO,ISRAGATORY,ISADDITIVE,ISEDITABLE,NEEDAUTOCODE ");
            strSql.Append(" FROM CFG_RESOURCE_INFO ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DBUtility.OracleHelper.Query(strSql.ToString());
        }
        public DataSet GetSelectControlValue(string strSql)
        {
            DataSet ds = new DataSet();
            ds = DBUtility.OracleHelper.Query(strSql);
            return ds;
        }
        public void GetExcutState(string strDelInsert)
        {


            DBUtility.OracleHelper.ExecuteSql(strDelInsert);

        }

    }
}
